**** Do votes matter - replication file****

*** Collapsing data-set to unique request-level 
** Unique request-level variables are identical, just the first observation per unique request is kept
use "M:\Userdata\Current\Projects\ENLaEX\Data\ENLaEX-final.dta", clear
gen urequest_first=0
by requestID, sort: replace urequest_first = 1 if _n == 1
drop if urequest_first==0
drop urequest_first

** Descriptive Statistics (unique request) 
* Overall (Table 1)
tab regulation
tab directive
tab amending
tab directive
tab derogation
tab extension
tab lower
tab blocking

* Success rate by type (Table 2)
tab cou_part_success type if commonposition==1, column 
tab cou_part_success type, column
tab final_part_success type, column 

tab cou_full_success type if commonposition==1, column 
tab cou_full_success type, column
tab final_full_success type, column 

gen part_success=.
replace part_success=0 if (cou_part_success==0) & (final_part_success==0)
replace part_success=0 if (cou_part_success==0) & (final_part_success==.)
replace part_success=1 if (cou_part_success==1) | (final_part_success==1)
tab part_success type, column

gen full_success=.
replace full_success=0 if (cou_full_success==0) & (final_full_success==0)
replace full_success=0 if (cou_full_success==0) & (final_full_success==.)
replace full_success=1 if (cou_full_success==1) | (final_full_success==1)
tab full_success type, column 

** Testing differences in proportions for success by blocking minority (Table 3)
tab blocking cou_part_success if commonposition==1, row chi
tab blocking cou_full_success if commonposition==1, row chi
tab blocking cou_part_success, row chi
tab blocking cou_full_success, row chi
tab blocking final_part_success, row chi
tab blocking final_full_success, row chi

** Multivariate analysis (Table 4)
* Full multilevel model with random intercept (blocking minority)
xtmelogit cou_part_success blocking i.type amending directive recitals_initial if commonposition==1 || proposal: 
estimates store cp_part_ml_h1
xtmelogit cou_full_success blocking i.type amending directive recitals_initial if commonposition==1 || proposal: 
estimates store cp_full_ml_h1
xtmelogit cou_part_success blocking i.type amending directive recitals_initial || proposal: 
estimates store first_part_ml_h1
xtmelogit cou_full_success blocking i.type amending directive recitals_initial || proposal: 
estimates store first_full_ml_h1
xtmelogit final_part_success blocking i.type amending directive recitals_initial || proposal: 
estimates store final_part_ml_h1
xtmelogit final_full_success blocking i.type amending directive recitals_initial || proposal: 
estimates store final_full_ml_h1
estout cp_part_ml_h1 cp_full_ml_h1 first_part_ml_h1 first_full_ml_h1 final_part_ml_h1 final_full_ml_h1, stats(N r2_p p_c) drop(1.type) starlevels( * 0.10 ** 0.05 *** 0.01) cells(b(star fmt(3)) se(par fmt(3))) legend mlabels(none)
* Full multilevel model with random intercept (sum of votes)
xtmelogit cou_part_success sumvotes i.type amending directive recitals_initial if commonposition==1 || proposal: 
estimates store cp_part_ml
xtmelogit cou_full_success sumvotes i.type amending directive recitals_initial if commonposition==1 || proposal: 
estimates store cp_full_ml
xtmelogit cou_part_success sumvotes i.type amending directive recitals_initial || proposal: 
estimates store first_part_ml
xtmelogit cou_full_success sumvotes i.type amending directive recitals_initial || proposal: 
estimates store first_full_ml
xtmelogit final_part_success sumvotes i.type amending directive recitals_initial || proposal: 
estimates store final_part_ml
xtmelogit final_full_success sumvotes i.type amending directive recitals_initial || proposal: 
estimates store final_full_ml
estout cp_part_ml cp_full_ml first_part_ml first_full_ml final_part_ml final_full_ml, stats(N r2_p p_c) drop(1.type) starlevels( * 0.10 ** 0.05 *** 0.01) cells(b(star fmt(3)) se(par fmt(3))) legend mlabels(none)

*** Predicted probabilities (multilevel, fixed effects only) (Figure 2)
xtmelogit cou_part_success sumvotes derogation extension amending directive recitals_initial if commonposition==1 || proposal: 
margins, at(sumvotes=(3(3)252) directive=1 derogation=1 extension=0 amending=0 recitals_initial(mean)) predict(mu fixedonly) saving(margins_cp_part, replace)
xtmelogit cou_full_success sumvotes derogation extension amending directive recitals_initial if commonposition==1 || proposal: 
margins, noci at(sumvotes=(3(3)252) directive=1 derogation=1 extension=0 amending=0 recitals_initial(mean)) predict(mu fixedonly) saving(margins_cp_full, replace)
xtmelogit cou_part_success sumvotes derogation extension amending directive recitals_initial || proposal: 
margins, noci at(sumvotes=(3(3)252) directive=1 derogation=1 extension=0 amending=0 recitals_initial(mean)) predict(mu fixedonly) saving(margins_first_part, replace)
xtmelogit cou_full_success sumvotes derogation extension amending directive recitals_initial || proposal: 
margins, at(sumvotes=(3(3)252) directive=1 derogation=1 extension=0 amending=0 recitals_initial(mean)) predict(mu fixedonly) saving(margins_first_full, replace)
xtmelogit final_part_success sumvotes derogation extension amending directive recitals_initial || proposal: 
margins, at(sumvotes=(3(3)252) directive=1 derogation=1 extension=0 amending=0 recitals_initial(mean)) predict(mu fixedonly) saving(margins_final_part, replace)
xtmelogit final_full_success sumvotes derogation extension amending directive recitals_initial || proposal: 
margins, at(sumvotes=(3(3)252) directive=1 derogation=1 extension=0 amending=0 recitals_initial(mean)) predict(mu fixedonly) saving(margins_final_full, replace)
combomarginsplot margins_cp_part margins_cp_full margins_first_part margins_first_full margins_final_part margins_final_full, noci labels("Common Position, partial" "Common Position, full" "First reading, partial" "First reading, full" "Final, partial" "Final, full")  file1opts(pstyle(p1)) file2opts(pstyle(p7)) file3opts(pstyle(p2)) file4opts(pstyle(p8)) file5opts(pstyle(p3)) file6opts(pstyle(p9))



 

